import { TableColumnObject } from 'amis/lib/renderers/Table'

class EnableColumnUtils {
	getSchema = (parmas: TableColumnObject): TableColumnObject => {
		const { name, label } = parmas

		const mergeSchema = Object.assign({
			name: name,
			label: label,
			type: 'mapping',
			map: {
				true: '启用',
				false: '禁用',
				'1': '启用',
				'0': '禁用',
				'*': `\${${name}}`,
			},
		} as TableColumnObject)

		const schema = mergeSchema as TableColumnObject
		return schema
	}
}

export default new EnableColumnUtils()
